<?php
// -----------------------------------------------------------------------------
// include
// -----------------------------------------------------------------------------

include "../config/config.php";
include "../auth.php";
include "../DBManager.php";

// -----------------------------------------------------------------------------
// 访问设置
// -----------------------------------------------------------------------------

if (!isset($_GET['id'])) {
    exit("需要传入有效的参数！");
}

$id = $_GET['id'];

// -----------------------------------------------------------------------------
// 数据库相关设置
// -----------------------------------------------------------------------------

$dbPath = "../" . $dbPath;
$db = new DBManager("sqlite:" . $dbPath);

// -----------------------------------------------------------------------------

/* 第一步，删除该分类下的所有链接 */
$db->deleteLinksUnderCategory($id);

/* 第二步，删除该分类 */
$db->deleteCategory($id);

echo "删除成功！";
